<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<title>${title}</title>
<link rel="stylesheet" href="${base}/css/default.css" type="text/css">
<script type="text/javascript" src="${base}/js/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="${base}/js/jquery.bxslider.min.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?ak=778E2c74a83040f77711588d0044421b&v=2.0"></script>
<script type="text/javascript">
$(function(){
	//baidu地图获取当前
	var geoc = new BMap.Geolocation();
	var geol = new BMap.Geocoder();
	
	geoc.getCurrentPosition(function(r){
		if(this.getStatus() == BMAP_STATUS_SUCCESS){
			
			geol.getLocation(r.point,function(rs){
				var store = window.localStorage||{};
				var comp = rs.addressComponents ;
				
				if(store['city']==null){
					$('#sa').val(comp.city);
				
				$.ajax({
					'url':'${base}/selector/getCityByName',
					'type':'post',
					'data':{name:comp.city},
					'dataType':'json',
					success:function(data){
						
						store['localCity'] = data.id ;
						store['city'] = data.name;
						store['localCityType'] = '2' ;		
					}
				})
				}else{
					$('#sa').val(store['city']);
				}
			}) ;
		}
		else {
			$("#sa").val('未知') ;
		}        
	},{enableHighAccuracy: true})
	
	//区域选择-显示、隐藏层
	 $('#sa').click(function(){
		$('.mask9').toggle();
		$('.sm-area-box').toggle();		
		$('html').toggleClass("ho9"); 
	 });
	 $('.mask9').click(function(){
		$(this).hide();
		$('.sm-area-box').hide();
	   $('html').toggleClass("ho9");
	 });
	
	//区域选择-选择地区
	//$(".sa-r-box").hide();
	$(".sa-l ul li:first").addClass("active").show();
	var pid = $(".sa-l ul li:first").find("span").attr("value");
	var name = $(".sa-l ul li:first").find("span").html();
	getCity(pid,name);
	$(".sa-r-box").show();
	$(".sa-l li").click(function() {
		$(".sa-l li").removeClass("active");
		$(this).addClass("active");
		$(".sa-r-box").hide(); 
		var provinceId = $(this).find("span").attr("value");
		var provincename = $(this).find("span").html();
		getCity(provinceId,provincename);
		$(".sa-r-box").fadeIn(0);
	});	
	
	function getCity(id,name){
		name= name+"全省";
		$.ajax({
			url:'${base}/selector/getCity',
			method:'get',
			dataType:'json',
			data:{provinceId:id},
			async:false,
			success:function(data){
				$('#tab1 ul').empty();
				$('#tab1 ul').append('<li><span onclick="javascript:getIt(this);" value="'+id+'" type="1">'+name+'</span></li>');
				for(var i=0;i<data.length;i++){
					$('#tab1 ul').append('<li><span onclick="javascript:getIt(this);" value="'+data[i].id+'" type="1">'+data[i].name+'</span></li>');
				}
			}
		})
	}
	
	//BANNER
	$('.bxslider').bxSlider({
		auto:true, //自动播放
  		autoControls:false, //自动滚动的控制键
		controls: false, //是否显示“previous”和“next”按钮
	});
});
</script>
</head>

<body>
<div class="mask9"></div>
<header>
	<div class="hd-sr"><input type="text" id="sa" placeholder="请选择地区" value="全国" readonly /><em></em></div>
    <h2>${title}</h2>
    <a href="${base}/search/index" title="" class="hd-sb"><span>搜索</span></a>
    <div class="sm-area-box">
        <div class="sa-l">
            <ul>
            	<#list provinceList as province>
                <li><span value="${province.id}">${province.name}</span></li>
                </#list>
            </ul>
        </div>
        <div class="sa-r">
            <div id="tab1" class="sa-r-box">
                <ul></ul>
            </div>
        </div>
    </div>
</header>
<nav>
  <ul>
    <li class="n1"><a href="${base}/index/index" class="on"><cite></cite><span>首页</span></a></li>
    <li class="n2"><a href="${base}/search/index"><cite></cite><span>搜索</span></a></li>
    <li class="n3"><a href="${base}/subscribe/index"><cite></cite><span>订阅</span></a></li>
    <li class="n4"><a href="${base}/center/index"><cite></cite><span>我的</span></a></li>
  </ul>
</nav>
<div class="slider">
    <ul class="bxslider">
        <li><img src="${base}/images/ls/banner01.png" /></li>
        <li><img src="${base}/images/ls/banner02.png" /></li>
        <li><img src="${base}/images/ls/banner01.png" /></li>
        <li><img src="${base}/images/ls/banner02.png" /></li>
    </ul>
</div>
<div class="main home">
    <div class="notice">
        <span class="nc-ico"></span>
        <span class="nc-go"></span>
        <div id="ns">
        	<#list currentList as news>
        	 	<a href="${base}/detail/index?id=${news.id}&type=${news.tableName}">${news.title}</a>
        	</#list>
        </div>
        <script type="text/javascript">
            var c,_=Function;
            with(o=document.getElementById("ns")){innerHTML+=innerHTML; onmouseover=_("c=1");onmouseout=_("c=0");}
            (F=_("if(#%30||!c)#++,#%=o.scrollHeight>>1;setTimeout(F,#%30?10:1500);".replace(/#/g,"o.scrollTop")))();
        </script>
    </div>
    <div class="home-entry clearfix">
    	<ul>
        	<li class="he01"><a href="${base}/search/columnSearch?column=gcjs" title=""><span></span><b>工程建筑</b></a></li>
        	<li class="he02"><a href="${base}/search/columnSearch?column=zfcg" title=""><span></span><b>政府采购</b></a></li>
        	<li class="he03"><a href="${base}/search/columnSearch?column=tdjy" title=""><span></span><b>土地交易</b></a></li>
        	<li class="he04"><a href="${base}/search/columnSearch?column=tdjy" title=""><span></span><b>国企采购</b></a></li>
        	<li class="he05"><a href="${base}/search/columnSearch?column=gyqjy" title=""><span></span><b>矿业权交易</b></a></li>
        	<li class="he06"><a href="#" title=""><span></span><b>环保绿化</b></a></li>
        	<li class="he07"><a href="#" title=""><span></span><b>医疗卫生</b></a></li>
        	<li class="he08"><a href="${base}/search/columnSearch?column=" title=""><span></span><b>全部</b></a></li>
        </ul>
    </div>
    <div class="li-hd"><a href="list.html" title=""><h3>热门推荐</h3><em></em></a></div>
    <div class="dli clearfix">
    	<ul class="sea-m-list"></ul>
    </div>
</div>

<script type='text/tmpl' id='itemTmpl'>
		<li>
        	<a href="${base}/detail/index?id=<!=id!>&type=<!=tableName!>" title="">
            	<div class="dli-box">
                    <strong><!=title!></strong>
                    <div>
                        <p>类型:<!=type!>&nbsp;&nbsp;&nbsp;发布日期:<!=updateTime!></p>
                        <b><!=area!></b>
                    </div>
                </div>
            </a>
            <div class="favor"><span onclick="tocollect(this)" value="<!=id!>" type="<!=tableName!>" <!if(collections!=0){!>class="sc"<!}!>>收藏</span></div>
        </li>
    </script>
    <script type="text/javascript" src="${base}/js/public/lib/baiduTemplate.js"></script>
    
	<script  type="text/javascript">
		 function getIt(obj){
		 	$("#sa").val(obj.innerHTML);
		 	
		 	var store = window.localStorage||{};
			store['localCity'] = $(obj).attr('value') ;
			store['city'] = obj.innerHTML;
			store['localCityType'] = $(obj).attr('type') ;
			
		 	$('.sm-area-box, .mask9').hide();
		  	$('html').toggleClass("ho9");
		 }
		 
		 $(function(){
		 var teamList = baidu.template('itemTmpl');
		 	$.ajax({
		 		'url':'${base}/index/recommend',
		 		'type':'post',
		 		dataType : 'json' ,
		 		'success':function(data){
		 			var n = data.length > 3 ? 3:data.length;
		 			for(var i = 0 ; i < n ; i++ ){
		 				$(".sea-m-list").append(teamList(data[i]));
		 			}
		 		}
		 	});
		 });
	
	function tocollect(obj){
		var $v=$(obj);
		//console.log($v.attr('value'))
		var id = $v.attr('value');
		var type = $v.attr('type');
		
		$.ajax({
				'url':'${base}/collect/insert',
				'type':'post',
				dataType:'json',
				data:{id:id,type:1},//0是news收藏
				success:function(data){
					alert(data.message);
				}
			});
			$v.toggleClass('sc');
		}
	
	
	</script>

</body>

</html>